﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArgusLib.Fractals
{
	public interface IDataSet
	{
		/// <summary>
		/// Initializes or resets the <c>IDataSet</c>.
		/// </summary>
		void Initialize(IParameter parameter);

		/// <summary>
		/// Gets the x-dimension of the data-array.
		/// </summary>
		int DimensionX { get; }

		/// <summary>
		/// Gets the y-dimension of the data-array.
		/// </summary>
		int DimensionY { get; }

		/// <summary>
		/// Gets the value at a given position in the data-array.
		/// </summary>
		object this[int x, int y] { get; set; }

		/// <summary>
		/// Checks if a given element is null.
		/// </summary>
		IndexedPropertyGet<bool, int, int> IsNull { get; }

		IndexedProperty<bool, int, int> IsFinished { get; }

		/// <summary>
		/// Processes the results of a calculation to provide additional data.
		/// </summary>
		void PostProcess();

		/// <summary>
		/// The parameter which were used to calculate the <c>IDataSet</c>.
		/// </summary>
		IParameter CalculationParameter { get; }

		/// <summary>
		/// Gets or sets the path to the file in which the <c>IDataSet</c> can dump data to
		/// free memory.
		/// </summary>
		string DumpFile { get; set; }

		/// <summary>
		/// Returns a value representing an approximation for the memory usage in Megabytes
		/// when initialized and during calcualtion.
		/// </summary>
		float GetMemoryUsage(IParameter parameter);

		/// <summary>
		/// Returns a value representing an approcimation for the additional the memory usage in Megabytes
		/// after <see cref="Initialize"/> was called during calculation.
		/// </summary>
		/// <returns></returns>
		float GetMemoryUsage();
	}

	public interface IDataSetProvider
	{
		IDataSet GetDataSet();

		/// <summary>
		/// When implemented, this property should return the type of <see cref="IDataSet"/>
		/// returned by <see cref="GetDataSet"/>.
		/// </summary>
		Type DataSetType { get; }
	}
}
